package com.dushan.boot.controller;

import com.dushan.boot.common.pojo.CommonResult;
import com.dushan.boot.common.pojo.PageResult;
import com.dushan.boot.convert.member.MemberExperienceRecordConvert;
import com.dushan.boot.domain.MemberExperienceRecordDO;
import com.dushan.boot.domain.vo.MemberExperienceRecordPageReqVO;
import com.dushan.boot.domain.vo.MemberExperienceRecordRespVO;
import com.dushan.boot.service.IMemberExperienceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.dushan.boot.common.pojo.CommonResult.success;

/**
 * @Author：朗朗乾坤
 * @Package：com.dushan.boot.controller
 * @Project：DuShanHui
 * @name：MemberExperienceRecordController
 * @Date：2024/1/24 20:27
 * @Filename：MemberExperienceRecordController
 */
@Tag(name = "管理后台 - 会员经验记录")
@RestController
@RequestMapping("/member/experience-record")
@Validated
public class MemberExperienceRecordController {

    @Resource
    private IMemberExperienceService experienceLogService;
    @GetMapping("/page")
    @Operation(summary = "获得会员经验记录分页")
//    @PreAuthorize("@ss.hasPermission('member:experience-record:query')")
    public CommonResult<PageResult<MemberExperienceRecordRespVO>> getExperienceRecordPage(
            @Valid MemberExperienceRecordPageReqVO pageVO) {
        PageResult<MemberExperienceRecordDO> pageResult = experienceLogService.getExperienceRecordPage(pageVO);
        return success(MemberExperienceRecordConvert.INSTANCE.convertPage(pageResult));
    }
}
